﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GIMS.MODEL;
using KPIS.GERP.GIMS.DAL;
using KPIS.GERP.GIMS.DALFactory;
using KPIS.DBM;

namespace KPIS.GERP.GIMS.BLL
{
    public class PurchaseRequestBLL
    {
        private static readonly PurchaseRequestDAL dal = DataAccess.CreatePurchaseRequest();

        public PurchaseRequestInfo GetPurchaseRequest(int Seq)
        {
            return dal.GetPurchaseRequest(Seq);
        }

        public PurchaseRequestInfo GetPurchaseRequestByBidder(int BidderSeq)
        {
            return dal.GetPurchaseRequestByBidder(BidderSeq);
        }

        public PurchaseRequestInfo GetPurchaseRequestUrgent(int Seq)
        {
            return dal.GetPurchaseRequestUrgent(Seq);
        }

        public IList<PurchaseRequestInfo> GetPurchaseRequest(int YearTypeSeq, int Year, Nullable<int> JobSiteSeq, Nullable<int> PurchaseTypeSeq, Nullable<int> PurchaseMethodSeq, string OperationName, string RecordStatus, int PprTypeSeq)
        {
            return dal.GetPurchaseRequest(YearTypeSeq, Year, JobSiteSeq, PurchaseTypeSeq, PurchaseMethodSeq, OperationName, RecordStatus, PprTypeSeq);
        }

        public IList<PurchaseRequestInfo> GetPurchaseRequestForBid(string search_text)
        {
            return dal.GetPurchaseRequestForBid(search_text);
        }

        public void Update(PurchaseRequestInfo info)
        {
            dal.Update(info);
        }

        public void Update(IList<PurchaseRequestInfo> infoList)
        {
            dal.Update(infoList);
        }

        public void UpdatePurchaseMethod(int PcSeq, int MethodSeq, string MethodSeqreason)
        {
            dal.UpdatePurchaseMethod(PcSeq, MethodSeq, MethodSeqreason);
        }

        public void UpdatePurchaseRequest(PurchaseRequestInfo info)
        {
            dal.UpdatePurchaseRequest(info);
        }

        public void Delete(PurchaseRequestInfo info)
        {
            dal.Delete(info);
        }

        public void DeleteAll(IList<PurchaseRequestInfo> infoList)
        {
            dal.DeleteAll(infoList);
        }

        public void ChangePurchaseEmployee(IList<PurchaseRequestInfo> infoList)
        {
            dal.ChangePurchaseEmployee(infoList);
        }

        public string UpdateTotalAndAmountConfirm_Urgent(PurchaseRequestInfo info, IList<PrePurchaseRequestItemInfo> infoListPprItem, IList<PurchaseRequestRouteInfo> infoListRoute)
        {
            return dal.UpdateTotalAndAmountConfirm_Urgent(info, infoListPprItem, infoListRoute);
        }

        public string UpdateTotalAndAmountConfirm(PurchaseRequestInfo info, IList<PrePurchaseRequestItemInfo> infoListPprItem, IList<PurchaseRequestRouteInfo> infoListRoute)
        {
            return dal.UpdateTotalAndAmountConfirm(info, infoListPprItem, infoListRoute);
        }

        public string UpdateTotalAndAmountConfirmForBidder(PurchaseRequestInfo info, IList<PrePurchaseRequestItemInfo> infoListPprItem, IList<PurchaseRequestRouteInfo> infoListRoute)
        {
            return dal.UpdateTotalAndAmountConfirmForBidder(info, infoListPprItem, infoListRoute);
        }

        public void Confirm(PurchaseRequestInfo info, IList<PurchaseRequestRouteInfo> infoListRoute, IDBManager dbManagerTrans)
        {
            dal.Confirm(info, infoListRoute, dbManagerTrans);
        }

        public void UpdatePurchaseRequestStatus(int pr_seq, string Status)
        {
            dal.UpdatePurchaseRequestStatus(pr_seq, Status);
        }
    }
}
